<?php
include_once('ClsSebent/config.php');
$qry="select * from site_page where id=".$del_id;
$res=mysql_query($qry);
$row=mysql_fetch_array($res);
$site=$row["site_id"];
$ptitle=mysql_escape_string($row["page_title"]);
$admin_pg=$row["admin_pg"];
//echo $del_id.'<BR>';
//echo $ptitle.'<BR>';
//echo $admin_pg;
if($site==101)
{	
//IF admin deletes, delete all..	
		$tqry="Select * from site_page where page_title='$ptitle' and page_update='Y'";
		//echo $tqry;
		$tres=mysql_query($tqry);
		
		while($trow=mysql_fetch_array($tres))
		{
		$siteid=$trow["site_id"];
		$qry1="delete from site_page where page_title='$ptitle' and site_id='$siteid'";
		//echo $qry1;
		mysql_query($qry1);
		$navqry="delete from site_navbar where link_page_title='$ptitle' and site_id='$siteid'";
		//echo $navqry;
		mysql_query($navqry);
		}	
}
if($site!=101)
{
	if($admin_pg=='N')
		{
		$qryx="delete from `site_page` where `id`='".$_REQUEST['del_id']."' ";
		mysql_query($qryx);
		$navqryx="delete from site_navbar where link_page_title='$ptitle' and site_id='$site'";
		//echo $navqry;
		mysql_query($navqryx);
		}
}
header("Location: page_content.php?site_id=".$sid);
?>